<?php
namespace app\index\controller;
use think\Controller;
use think\Request;
use think\Session;

class Common extends Controller{

    function __construct(Request $request){
        parent::__construct($request);
        $action = $request->controller() . '/' . $request->action();
        if(!in_array(strtolower($action), array('index/login', 'index/register')) && !Session::get('user_info')){
            $this->redirect(url('index/login'));
        }
    }

}